Category >
JQUERY
|| Published on :
Saturday, August 9, 2014 || Views:
13613
||
jQuery tips & tricks how to limit characters inside a textarea JQueyLimit jquerytextarea
Introduction:
Here Pawan Kumar will explain how to use jQuery to limit number of characters in textarea(textbox) in ASP.NET.This will work even when user is copying and pasting text into the textarea or textbox or in other words how can we use jQuery to restrict textbox's or textarea's length with detailed example.
Description:
In previous post I explainedHow to use AJAX Timer Control in ASP.NET using C# with Example and Source Codes,How can we Insert, Update, Delete Records in ASP.NET Server Control ListView in ASP.NET with C#,How to Convert Numbers to Words String in ASP.NET using C#,Get todays Day Name SQL server,Set meta tag in asp.net programmaticaly for creating seo friendly websites,How to validate or check whether checkbox is checked or not using ASP.NET and jQuery with example.and many more articles.
Now I will explain how to use jQuery to limit number of characters in textarea(textbox)
So follow the steps to learn and Using jQuery How We Can Limit Number of Characters in Textarea or Textbox.
Step 1: First, we start by creating an Empty ASP.NET web site in Visual Studio .NET 2010.
Step 2: Create an ASPX Page for Right Click on Solution Explorer > Add Items > Web > Webform and save it as "Default.aspx".When we first open our Default.aspx page
Step 3: Add the jQuery CDN like below to the default page.To implement this we need to write the code lilke as shown below
Must Read: Load jQuery .js file even if the Google CDN is down
Step 4: Write the jQuery Codes like below:-
Step 5: Complete Source Code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
"http://www.w3.org/1999/xhtml">
Using jQuery Limit Number of Characters in a TextArea
"spnRemaining">150 Characters left
Step 6: Output will be like below screenshot.
Conclusion:
So, In this tutorial we have learned, Using jQuery How We Can Limit Number of Characters in Textarea or Text in ASP.NET with detailed explanation.
Download Source Codes